package cminus;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import javax.swing.tree.DefaultMutableTreeNode;


public class TreeNode extends DefaultMutableTreeNode{
		private File file;		//该节点对应的文件
		private List<TreeNode> children;	//该节点下的子节点集合
		
		/**
		 * 带参数的构造方法
		 * @param file
		 * @param allowsChildren
		 */
		public TreeNode(File file ,boolean allowsChildren)
		{
			super(file.getName(),allowsChildren);
			this.file = file;
			if(allowsChildren)
			{
				children = new ArrayList<TreeNode>();
			}
			else children = null;
		}
		
		/**getters and setters**/
		public File getFile() {
			return file;
		}
		public String getFileName() {
			return file.getName();
		}
		public void setFile(File file) {
			this.file = file;
		}
		public List<TreeNode> getChildren() {
			return children;
		}
		public void setChildren(List<TreeNode> children) {
			this.children = children;
		}
		
}
